<template>
	<view>
		<view class="nav" :style="{height:BarTop + BarHeight + 10 + 'px'}"></view>
		<view class="topbox" >
			<view class="top">
				<image src="https://yhflsyz.oss-cn-guangzhou.aliyuncs.com/shoping/yes%402x.png" mode="" style="width: 44rpx;height: 44rpx;margin-right: 10rpx;"></image>
				<view class="topsp">
					兑换成功
				</view>
			</view>
			<view class="top-btn">
				<view class="btn1" style="margin-right: 10rpx;" @click="Gotodin">
					<image src="https://yhflsyz.oss-cn-guangzhou.aliyuncs.com/shoping/goding%402x.png" mode="" style="width: 100%;height: 100%;"></image>
				</view>
				<view class="btn1" style="margin-left: 10rpx;" @click="Gotoshop">
					<image src="https://yhflsyz.oss-cn-guangzhou.aliyuncs.com/shoping/goshop%402x.png" mode="" style="width: 100%;height: 100%;"></image>
				</view>
			</view>
		</view>
		
		<view class="Youlove">
			<view class="title">
				<image src="https://yhflsyz.oss-cn-guangzhou.aliyuncs.com/shoping/Union%402x.png" mode="" style="width: 26rpx;height: 22rpx;"></image>
				<view class="titlename">
					为您推荐
				</view>
			</view>
			<view class="main" >
				<view class="" style="width: 100%;height: 1rpx;"></view>
				<view class="mainbox" v-for="(item,index) in data" :key="index" @click="GotoInfo(item)">
					<image :src="item.image" mode="" class="mainimg"></image>
					<view class="main-title">
						{{item.title}}
					</view>
					<view class="main-price">
						<text style="font-size: 28rpx;">券</text>{{item.price}}
					</view>
					<view class="main-btn">
						立即兑换
					</view>
				</view>
			</view>
		</view>
		
	</view>
</template>
<style scoped>
	page{
		background-color: #F6F8F7;
	}
	.nav{
		position: relative;
		top: 0;
		background-color: #FFFFFF;
	}
	.topbox{
		width: 750rpx;
		height: 202rpx;
		background: linear-gradient( 180deg, #FFFFFF 0%, rgba(255,255,255,0) 100%);
		position: relative;
	}
	.top{
		width: 100%;
		height: 44rpx;
		display: flex;
		justify-content: center;
	}
	.topsp{
		width: 176rpx;
		height: 44rpx;
		font-size: 44rpx;
		color: #1F2921;
		font-weight: bold;
		line-height: 44rpx;
		margin-left: 10rpx;
	}
	.top-btn{
		width: 100%;
		height: 78rpx;
		display: flex;
		justify-content: center;
		position: absolute;
		bottom: 34rpx;
	}
	.btn1{
		width: 286rpx;
		height: 78rpx;
		border-radius: 50rpx;
	}
	.Youlove{
		width: 690rpx;
		margin-left: 30rpx;
	}
	.title{
		width: 100%;
		height: 28rpx;
		line-height: 28rpx;
		display: flex;
		align-items: center;
	}
	.titlename{
		font-size: 28rpx;
		color: #1F2921;
		font-weight: bold;
	}
	.main{
		width: 690rpx;
		/* height: 500rpx; */
		/* border: 1px red solid; */
		display: flex;
		justify-content: space-between;
		
		flex-wrap: wrap;
	}
	.mainbox{
		width: 336rpx;
		height: 484rpx;
		border-radius: 16rpx;
		background-color: white;
		position: relative;
		margin-top: 20rpx;
	}
	.mainimg{
		width: 100%;
		height: 338rpx;
		border-top-right-radius: 16rpx;
		border-top-left-radius: 16rpx;
	}
	.main-title{
		width: 320rpx;
		margin-left: 16rpx;
		font-size: 28rpx;
		color: #1F2921;
		height: 30rpx;
		margin-top: 16rpx;
		line-height: 26rpx;
		text-overflow:ellipsis;/*省略号 */
		 white-space:nowrap;/*溢出时不换行 */
		 overflow:hidden;/*溢出时隐藏 */
	}
	.main-price{
		min-width: 70rpx;
		height: 28rpx;
		color: #36BE6A;
		font-size: 36rpx;
		/* margin-top: 34rpx; */
		position: absolute;
		bottom: 50rpx;
		margin-left: 16rpx;
	}
	.main-btn{
		width: 128rpx;
		height: 48rpx;
		text-align: center;
		line-height: 48rpx;
		background-color: #1DCF79;
		border-radius: 42rpx;
		position: absolute;
		bottom: 32rpx;
		right: 16rpx;
		color: white;
		font-size: 24rpx;
	}
</style>
<script>
	export default {
		data() {
			return {
				BarTop:'',
				BarHeight:'',
				data:'',
				id:'',
				flag:true
				
			}
		},
		onLoad(option) {
			// #ifdef MP-WEIXIN
			let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
			   this.BarTop = menuButtonInfo.top;
			   this.BarHeight = menuButtonInfo.height;
			// #endif
			
			this.$u.api.shop.getYoulike().then(res =>{
				if(res.code == 1){
					this.data = res.data.data
				}
			})
			this.id = option.id
		},
		methods:{
			GotoInfo(item){
				uni.navigateTo({
					url:`./product?id=${item.id}`
				})
			},
			Gotodin(){
				uni.navigateTo({
					url:`./AwaitShipments?order_id=${this.id}`
				})
			},
			Gotoshop(){
				uni.switchTab({
					url:'./index'
				})
			},
		},

		
	}
</script>



